package com.chance.cc.crawler.development.bootstrap.taobao;

import com.chance.cc.crawler.core.selector.Json;

/**
 * @author bx
 * @date 2020/11/11 0011 10:44
 */
public class TaobaoStart {

    public static final String itemUrl = "https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?jsv=2.5.7&appKey=12574478&t=%s&api=mtop.taobao.detail.getdetail&v=6.0&isSec=0&ecode=0&AntiFlood=true&AntiCreep=true&H5Request=true&ttid=2018%%40taobao_h5_9.9.9&type=jsonp&dataType=jsonp&data=%%7B%%22spm%%22%%3A%%22a230r.1.14.48.6c1d4af9UmOqpx%%22%%2C%%22id%%22%%3A%%22%s%%22%%2C%%22ns%%22%%3A%%221%%22%%2C%%22abbucket%%22%%3A%%226%%22%%2C%%22itemNumId%%22%%3A%%22%s%%22%%2C%%22itemId%%22%%3A%%22%s%%22%%2C%%22exParams%%22%%3A%%22%%7B%%5C%%22spm%%5C%%22%%3A%%5C%%22a230r.1.14.48.6c1d4af9UmOqpx%%5C%%22%%2C%%5C%%22id%%5C%%22%%3A%%5C%%22%s%%5C%%22%%2C%%5C%%22ns%%5C%%22%%3A%%5C%%221%%5C%%22%%2C%%5C%%22abbucket%%5C%%22%%3A%%5C%%226%%5C%%22%%7D%%22%%2C%%22detail_v%%22%%3A%%228.0.0%%22%%2C%%22utdid%%22%%3A%%221%%22%%7D";
    public static final String itemId = "592068058672";
    public static final String domainId = "taobao";

    public static void main(String[] args) {
//        String a = "{\"collectionTime\":1608715645923,\"crawlerContent\":\"{\\\"itemId\\\":\\\"612876818887\\\",\\\"detailUrl\\\":\\\"https://item.taobao.com/item.htm?id=612876818887&ns=1&abbucket=7#detail\\\",\\\"userId\\\":\\\"2635892541\\\"}\",\"dataId\":\"taobao-特步-article-612876818887-2635892541\",\"filter\":\"key\",\"filterInfos\":[{\"addKeyToQueue\":true,\"countTotalNum\":0,\"curCount\":1,\"date\":0,\"filter\":\"key\",\"hourFromNow\":0,\"key\":\"taobao-特步-article-612876818887-2635892541\",\"keyQueueConfig\":{\"queueContent\":\"filterKey\",\"queueName\":\"filter-taobao-search-queue\",\"queueStorage\":\"memory\",\"queueStructure\":\"set\"}}],\"filterPipelineResult\":false,\"releaseTime\":1608715653020,\"scheduleTime\":1608715623759,\"tags\":{\"crawler_request_tag\":{\"category\":\"crawler_request_tag\",\"labelTags\":{\"filter_request\":{\"label\":\"filter_request\"},\"result_request\":{\"label\":\"result_request\"}}},\"crawler_schedule_tag\":{\"category\":\"crawler_schedule_tag\",\"kvTags\":{\"Schedule_Trigger_Time\":{\"key\":\"Schedule_Trigger_Time\",\"val\":1608715623759},\"Schedule_Trigger_Job_Key\":{\"key\":\"Schedule_Trigger_Job_Key\",\"val\":\"taobao-taobao\"},\"Schedule_Trigger_Key\":{\"key\":\"Schedule_Trigger_Key\",\"val\":\"taobao-taobao-taobao\"}}},\"crawler_business_tag\":{\"category\":\"crawler_business_tag\",\"kvTags\":{\"taobao_search_keyword\":{\"key\":\"taobao_search_keyword\",\"val\":\"特步\"}}}},\"url\":\"https://s.taobao.com/search?q=%E7%89%B9%E6%AD%A5&js=1&stats_click=search_radio_all%3A1&ie=utf8&p4ppushleft=%2C44&sort=default&s=0\"}";
        String a = "{\"collectionTime\":1608715645923,\"crawlerContent\":\"{\\\"itemId\\\":\\\"612876818887\\\",\\\"dataId\\\":\\\"taobao-612876818887-2635892541\\\",\\\"detailUrl\\\":\\\"https://item.taobao.com/item.htm?id=612876818887&ns=1&abbucket=7#detail\\\",\\\"userId\\\":\\\"2635892541\\\"}\",\"dataId\":\"taobao-特步-article-612876818887-2635892541\",\"filter\":\"key\",\"filterInfos\":[{\"addKeyToQueue\":true,\"countTotalNum\":0,\"curCount\":1,\"date\":0,\"filter\":\"key\",\"hourFromNow\":0,\"key\":\"taobao-特步-article-612876818887-2635892541\",\"keyQueueConfig\":{\"queueContent\":\"filterKey\",\"queueName\":\"filter-taobao-search-queue\",\"queueStorage\":\"memory\",\"queueStructure\":\"set\"}}],\"filterPipelineResult\":false,\"releaseTime\":1608715653020,\"scheduleTime\":1608715623759,\"tags\":{\"crawler_request_tag\":{\"category\":\"crawler_request_tag\",\"labelTags\":{\"filter_request\":{\"label\":\"filter_request\"},\"result_request\":{\"label\":\"result_request\"}}},\"crawler_schedule_tag\":{\"category\":\"crawler_schedule_tag\",\"kvTags\":{\"Schedule_Trigger_Time\":{\"key\":\"Schedule_Trigger_Time\",\"val\":1608715623759},\"Schedule_Trigger_Job_Key\":{\"key\":\"Schedule_Trigger_Job_Key\",\"val\":\"taobao-taobao\"},\"Schedule_Trigger_Key\":{\"key\":\"Schedule_Trigger_Key\",\"val\":\"taobao-taobao-taobao\"}}},\"crawler_business_tag\":{\"category\":\"crawler_business_tag\",\"kvTags\":{\"taobao_search_keyword\":{\"key\":\"taobao_search_keyword\",\"val\":\"特步\"}}}},\"url\":\"https://s.taobao.com/search?q=%E7%89%B9%E6%AD%A5&js=1&stats_click=search_radio_all%3A1&ie=utf8&p4ppushleft=%2C44&sort=default&s=0\"}";
        Json resulJson = new Json(a);
        String content = resulJson.jsonPath("$.crawlerContent").get();
        String dataId = resulJson.jsonPath("$.dataId").get();
        resulJson = new Json(content);

        try {
            dataId = resulJson.jsonPath("$.dataId").get();
        } catch (Exception e) {

        }
        System.out.println(dataId);

    }
}
